<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin_important extends MY_Controller {

	function Admin_important()
	{
		parent::MY_Controller();
		parent::check_admin_login();
	}
	
	function index(){
		//
	}
	
	//打款信息
	function remit_money($order_id){
		$this->load->model('Mimportant');
		$remit_money_info=$this->Mimportant->remit_money_info($order_id);
		$this->template->view('admin/remit_money_info',array('remit_money_info'=>$remit_money_info));
	}
	
	function save(){
		$form = array('orderid','id','account','pwd','wb_name','game_id','game_name','area','server');
		$values = $this->input->get_data($form);
		$config['upload_path'] = $this->config->item('upload_uri').'cards/';
		if(!file_exists($config['upload_path'])){
			mkdir($config['upload_path']);
			chmod($config['upload_path'],0777);
		}
		$config['allowed_types'] = $this->config->item('card_img_types');
		$config['max_size'] = $this->config->item('card_img_max_size');
		$config['encrypt_name'] = TRUE;
		$config['file_name'] = $values['orderid'];
		$this->load->library('upload', $config);
		if ($this->upload->do_upload('img')) {
			$data = $this->upload->data();
            $values['img'] = $data['file_name'];
		} else {
			echo $this->upload->display_errors();
		}
		$values['up_time'] = date('Y-m-d H:i:s');
		$this->load->model('Mimportant');
		//print_r($values);exit;
		if($this->Mimportant->save_important($values)){
			echo 'succ';
		} else {
			echo 'fail';
		}
	}
	
}
?>